from django.shortcuts import render

# Create your views here.

from rest_framework.generics import ListAPIView
from rest_framework.views import APIView
from .models import Banner
from rest_framework.response import Response


# 轮播图视图
class BannerListAPIView(ListAPIView):
    pass


from . import models

from .serializers import BannerAPIViewSerializers


# 使用APIView
class BannerAPIView(APIView):

    def get(self, request, *args, **kwargs):
        print(request)

        obj = models.Banner.objects.filter(is_show=True).all()

        data = BannerAPIViewSerializers(obj, many=True)
        print(obj)
        print(data.data)
        return Response(data.data)
        pass




# 首页导肮栏